import Taro from '@tarojs/taro'

export function useScrollViewHeight(options: { ignoreStatusBar?: boolean; value: number }) {
  const windowInfo = Taro.getWindowInfo()

  return (
    windowInfo.screenHeight -
    (!options.ignoreStatusBar ? windowInfo.statusBarHeight ?? 0 : 0) -
    (windowInfo.windowWidth / 750) * options.value
  )
}

export function upx2px(value: number) {
  const windowInfo = Taro.getWindowInfo()

  return (windowInfo.windowWidth / 750) * value
}
